/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 * 
 * http://www.inf.udec.cl/~jlopez/DSWR/LABORATORIOS/txobjt.html
 * 
 */
package serializar;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.net.ServerSocket;
import java.net.Socket;

/**
 *
 * @author Rodrigo
 */
public class servdeco {
    public static void main(String[] args) {
         ServerSocket serverSocket = null;
         try {
              serverSocket = new ServerSocket(20000);

              Socket clientSocket = null;
              while(true){
                  clientSocket = serverSocket.accept();
                       

            ObjectInputStream in= new ObjectInputStream(clientSocket.getInputStream());
            objeto prub;
            prub = (objeto)in.readObject();
            in.close();
            prub.imprimir();
            
            
        }
        }
         catch (IOException e) {
           System.err.println("No se puede escuchar en puerto:20000.");
                          System.exit(1);
                      }
                 catch (Exception e) {
            System.err.println("Caught exception " + e.toString());
        }

         }
    
}
